// 保存所有的图形对象
let allEcharts = []

// 当屏幕尺寸改变时触发的事件
window.addEventListener('resize', () => {
    // 循环页面中所有的图形
    allEcharts.forEach(v => {
        // 让图形调整尺寸
        v.resize()
    })
})
    // 全国用户总量统计
    ; (function () {
        // 创建dom元素
        const dom = document.getElementById('m2-zhu')
        // 创建echarts对象
        const o = echarts.init(dom)
        // 构造数据
        const option = {
            title: {
                text: '全国用户总量统计',
                textStyle: {
                    fontWeight: 'normal',
                    fontSize: 16,
                    color: '#F1F1F3'
                },
                top: '5%',
                left: '1.5%'
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'shadow'
                }
            },
            grid: {
                top: '20%',
                right: '13%',
                left: '10%',
                bottom: '22%'
            },
            xAxis: [{
                type: 'category',
                data: ['上海', '北京', '西安', '...', '浙江', '河南', '河北', '济南', '合肥'],
                axisLine: {
                    lineStyle: {
                        color: 'rgba(255,255,255,0.12)'
                    }
                },
                axisLabel: {
                    margin: 10,
                    color: '#e2e9ff',
                    textStyle: {
                        fontSize: 14
                    },
                },
            }],
            yAxis: [{
                splitNumber: 3,
                axisLabel: {
                    formatter: '{value}',
                    color: '#e2e9ff',
                },
                axisLine: {
                    show: false
                },
                splitLine: {
                    show: false,
                    lineStyle: {
                        color: '#233e64'
                    }
                },
            }],
            series: [{
                type: 'bar',
                data: [2100, 2450, 2770, 2203, 2255, 1188, 2156, 2280, 1792],
                barWidth: '15px',
                itemStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(0,244,255,1)' // 0% 处的颜色
                        }, {
                            offset: 1,
                            color: 'rgba(0,77,167,1)' // 100% 处的颜色
                        }], false),
                        shadowColor: 'rgba(0,160,221,1)',
                        shadowBlur: 4,
                    }
                }
            }]
        };

        o.setOption(option)
    })()

    // 航线模拟
    ; (function () {
        // 创建dom元素
        const dom = document.getElementById('china-a')
        // 创建echarts对象
        const o = echarts.init(dom)
        // 保存到全局数组中
        allEcharts.push(o)
        var geoCoordMap = {
            '上海': [121.4648, 31.2891],
            '东莞': [113.8953, 22.901],
            '东营': [118.7073, 37.5513],
            '中山': [113.4229, 22.478],
            '临汾': [111.4783, 36.1615],
            '临沂': [118.3118, 35.2936],
            '丹东': [124.541, 40.4242],
            '丽水': [119.5642, 28.1854],
            '乌鲁木齐': [87.9236, 43.5883],
            '佛山': [112.8955, 23.1097],
            '保定': [115.0488, 39.0948],
            '兰州': [103.5901, 36.3043],
            '包头': [110.3467, 41.4899],
            '北京': [116.4551, 40.2539],
            '北海': [109.314, 21.6211],
            '南京': [118.8062, 31.9208],
            '南宁': [108.479, 23.1152],
            '南昌': [116.0046, 28.6633],
            '南通': [121.1023, 32.1625],
            '厦门': [118.1689, 24.6478],
            '台州': [121.1353, 28.6688],
            '合肥': [117.29, 32.0581],
            '呼和浩特': [111.4124, 40.4901],
            '咸阳': [108.4131, 34.8706],
            '哈尔滨': [127.9688, 45.368],
            '唐山': [118.4766, 39.6826],
            '嘉兴': [120.9155, 30.6354],
            '大同': [113.7854, 39.8035],
            '大连': [122.2229, 39.4409],
            '天津': [117.4219, 39.4189],
            '太原': [112.3352, 37.9413],
            '威海': [121.9482, 37.1393],
            '宁波': [121.5967, 29.6466],
            '宝鸡': [107.1826, 34.3433],
            '宿迁': [118.5535, 33.7775],
            '常州': [119.4543, 31.5582],
            '广州': [113.5107, 23.2196],
            '廊坊': [116.521, 39.0509],
            '延安': [109.1052, 36.4252],
            '张家口': [115.1477, 40.8527],
            '徐州': [117.5208, 34.3268],
            '德州': [116.6858, 37.2107],
            '惠州': [114.6204, 23.1647],
            '成都': [103.9526, 30.7617],
            '扬州': [119.4653, 32.8162],
            '承德': [117.5757, 41.4075],
            '拉萨': [91.1865, 30.1465],
            '无锡': [120.3442, 31.5527],
            '日照': [119.2786, 35.5023],
            '昆明': [102.9199, 25.4663],
            '杭州': [119.5313, 29.8773],
            '枣庄': [117.323, 34.8926],
            '柳州': [109.3799, 24.9774],
            '株洲': [113.5327, 27.0319],
            '武汉': [114.3896, 30.6628],
            '汕头': [117.1692, 23.3405],
            '江门': [112.6318, 22.1484],
            '沈阳': [123.1238, 42.1216],
            '沧州': [116.8286, 38.2104],
            '河源': [114.917, 23.9722],
            '泉州': [118.3228, 25.1147],
            '泰安': [117.0264, 36.0516],
            '泰州': [120.0586, 32.5525],
            '济南': [117.1582, 36.8701],
            '济宁': [116.8286, 35.3375],
            '海口': [110.3893, 19.8516],
            '淄博': [118.0371, 36.6064],
            '淮安': [118.927, 33.4039],
            '深圳': [114.5435, 22.5439],
            '清远': [112.9175, 24.3292],
            '温州': [120.498, 27.8119],
            '渭南': [109.7864, 35.0299],
            '湖州': [119.8608, 30.7782],
            '湘潭': [112.5439, 27.7075],
            '滨州': [117.8174, 37.4963],
            '潍坊': [119.0918, 36.524],
            '烟台': [120.7397, 37.5128],
            '玉溪': [101.9312, 23.8898],
            '珠海': [113.7305, 22.1155],
            '盐城': [120.2234, 33.5577],
            '盘锦': [121.9482, 41.0449],
            '石家庄': [114.4995, 38.1006],
            '福州': [119.4543, 25.9222],
            '秦皇岛': [119.2126, 40.0232],
            '绍兴': [120.564, 29.7565],
            '聊城': [115.9167, 36.4032],
            '肇庆': [112.1265, 23.5822],
            '舟山': [122.2559, 30.2234],
            '苏州': [120.6519, 31.3989],
            '莱芜': [117.6526, 36.2714],
            '菏泽': [115.6201, 35.2057],
            '营口': [122.4316, 40.4297],
            '葫芦岛': [120.1575, 40.578],
            '衡水': [115.8838, 37.7161],
            '衢州': [118.6853, 28.8666],
            '西宁': [101.4038, 36.8207],
            '西安': [109.1162, 34.2004],
            '贵阳': [106.6992, 26.7682],
            '连云港': [119.1248, 34.552],
            '邢台': [114.8071, 37.2821],
            '邯郸': [114.4775, 36.535],
            '郑州': [113.4668, 34.6234],
            '鄂尔多斯': [108.9734, 39.2487],
            '重庆': [107.7539, 30.1904],
            '金华': [120.0037, 29.1028],
            '铜川': [109.0393, 35.1947],
            '银川': [106.3586, 38.1775],
            '镇江': [119.4763, 31.9702],
            '长春': [125.8154, 44.2584],
            '长沙': [113.0823, 28.2568],
            '长治': [112.8625, 36.4746],
            '阳泉': [113.4778, 38.0951],
            '青岛': [120.4651, 36.3373],
            '韶关': [113.7964, 24.7028]
        };

        var XAData = [
            [{
                name: '西安'
            }, {
                name: '北京',
                value: 100
            }],
            [{
                name: '西安'
            }, {
                name: '上海',
                value: 100
            }],
            [{
                name: '西安'
            }, {
                name: '广州',
                value: 100
            }],
            [{
                name: '西安'
            }, {
                name: '西宁',
                value: 100
            }],
            [{
                name: '西安'
            }, {
                name: '银川',
                value: 100
            }],
            [{
                name: '西安'
            }, {
                name: '拉萨',
                value: 100
            }]
        ];

        var XNData = [
            [{
                name: '西宁'
            }, {
                name: '北京',
                value: 100
            }],
            [{
                name: '西宁'
            }, {
                name: '上海',
                value: 100
            }],
            [{
                name: '西宁'
            }, {
                name: '广州',
                value: 100
            }],
            [{
                name: '西宁'
            }, {
                name: '西安',
                value: 100
            }],
            [{
                name: '西宁'
            }, {
                name: '银川',
                value: 100
            }]
        ];

        var YCData = [
            [{
                name: '银川'
            }, {
                name: '北京',
                value: 100
            }],
            [{
                name: '银川'
            }, {
                name: '广州',
                value: 100
            }],
            [{
                name: '银川'
            }, {
                name: '上海',
                value: 100
            }],
            [{
                name: '银川'
            }, {
                name: '西安',
                value: 100
            }],
            [{
                name: '银川'
            }, {
                name: '西宁',
                value: 100
            }],
        ];
        var LSData = [
            [{
                name: '拉萨'
            }, {
                name: '哈尔滨',
                value: 100
            }],
            [{
                name: '拉萨'
            }, {
                name: '北京',
                value: 100
            }],
            [{
                name: '拉萨'
            }, {
                name: '西安',
                value: 100
            }],
            [{
                name: '拉萨'
            }, {
                name: '潍坊',
                value: 100
            }]
        ];
        var planePath = 'path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134.449-92.931l12.238-241.308L1705.06,1318.313z';
        //var planePath = 'arrow';
        var convertData = function (data) {

            var res = [];
            for (var i = 0; i < data.length; i++) {

                var dataItem = data[i];

                var fromCoord = geoCoordMap[dataItem[0].name];
                var toCoord = geoCoordMap[dataItem[1].name];
                if (fromCoord && toCoord) {
                    res.push({
                        fromName: dataItem[0].name,
                        toName: dataItem[1].name,
                        coords: [fromCoord, toCoord],
                        value: dataItem[1].value
                    });
                }
            }
            return res;

        };

        var color = ['#a6c84c', '#ffa022', '#46bee9', '#46bee9']; //航线的颜色
        var series = [];
        [
            ['西安', XAData],
            ['西宁', XNData],
            ['银川', YCData],
            ['拉萨', LSData]
        ].forEach(function (item, i) {
            series.push({
                name: item[0] + ' Top3',
                type: 'lines',
                zlevel: 1,
                effect: {
                    show: true,
                    period: 6,
                    trailLength: 0.7,
                    color: 'red', //arrow箭头的颜色
                    symbolSize: 3
                },
                lineStyle: {
                    normal: {
                        color: color[i],
                        width: 0,
                        curveness: 0.2
                    }
                },
                data: convertData(item[1])
            }, {
                name: item[0] + ' Top3',
                type: 'lines',
                zlevel: 2,
                symbol: ['none', 'arrow'],
                symbolSize: 10,
                effect: {
                    show: true,
                    period: 6,
                    trailLength: 0,
                    symbol: planePath,
                    symbolSize: 15
                },
                lineStyle: {
                    normal: {
                        color: color[i],
                        width: 1,
                        opacity: 0.6,
                        curveness: 0.2
                    }
                },
                data: convertData(item[1])
            }, {
                name: item[0] + ' Top3',
                type: 'effectScatter',
                coordinateSystem: 'geo',
                zlevel: 2,
                rippleEffect: {
                    brushType: 'stroke'
                },
                label: {
                    normal: {
                        show: true,
                        position: 'right',
                        formatter: '{b}'
                    }
                },
                symbolSize: function (val) {
                    return val[2] / 8;
                },
                itemStyle: {
                    normal: {
                        color: color[i],
                    },
                    emphasis: {
                        areaColor: '#2B91B7'
                    }
                },
                data: item[1].map(function (dataItem) {
                    return {
                        name: dataItem[1].name,
                        value: geoCoordMap[dataItem[1].name].concat([dataItem[1].value])
                    };
                })
            });
        });
        var option = {
            title: {
                text: ' 设备数据统计',
                textStyle: {
                    fontWeight: 'normal',
                    fontSize: 16,
                    color: '#F1F1F3'
                },
                top: '5%',
                left: '1.5%'
            },
            tooltip: {
                trigger: 'item',
                formatter: function (params, ticket, callback) {
                    if (params.seriesType == "effectScatter") {
                        return "线路：" + params.data.name + "" + params.data.value[2];
                    } else if (params.seriesType == "lines") {
                        return params.data.fromName + ">" + params.data.toName + "<br />" + params.data.value;
                    } else {
                        return params.name;
                    }
                }
            },
            geo: {
                map: 'china',
                label: {
                    emphasis: {
                        show: true,
                        color: '#fff'
                    }
                },
                roam: true,
                itemStyle: {
                    normal: {
                        areaColor: '#142957',
                        borderColor: '#195BB9',
                        borderWidth: 1,
                    },
                    emphasis: {
                        areaColor: '#2B91B7'
                    }
                }
            },
            series: series
        };
        o.setOption(option)
    })()

    // 点位分布统计
    ; (function () {
        // 创建dom元素
        const dom = document.getElementById('dwfb')
        // 创建echarts对象
        const o = echarts.init(dom)
        const option = {
            title: {
                text: '点位分布统计',
                textStyle: {
                    fontWeight: 'normal',
                    fontSize: 16,
                    color: '#F1F1F3'
                },
                top: '5%',
                left: '5%'
            },
            legend: {
                orient: 'vertical',
                top: "center",
                right: "5%",
                textStyle: {
                    color: "#fff",
                    fontSize: 16
                }
            },
            tooltip: {
                trigger: 'item',
                formatter: '{a} <br/>{b} : {c} ({d}%)'
            },
            series: [{
                name: '点位统计',
                type: 'pie',
                radius: ['15%', '55%'],
                center: ['40%', '50%'],
                roseType: 'radius',
                label: {
                    show: true,
                    normal: {
                        position: 'outside',
                        fontSize: 16
                    }
                },
                labelLine: {
                    length: 1,
                    length2: 20,
                    smooth: true
                },
                data: [{
                    value: 1,
                    name: '云南',
                    itemStyle: {
                        color: "#006cff",
                        borderColor: "#006cff",
                        borderWidth: 3
                    }
                },
                {
                    value: 2,
                    name: '北京',
                    itemStyle: {
                        color: "#60cda0",
                        borderColor: "#60cda0",
                        borderWidth: 3
                    }
                },
                {
                    value: 3,
                    name: '重庆',
                    itemStyle: {
                        color: "#ff9f7f",
                        borderColor: "#ff9f7f",
                        borderWidth: 3
                    }
                },
                {
                    value: 4,
                    name: '湖南',
                    itemStyle: {
                        color: "#32c5e9",
                        borderColor: "#32c5e9",
                        borderWidth: 3
                    }
                },
                {
                    value: 5,
                    name: '四川',
                    itemStyle: {
                        color: "#9fe6b8",
                        borderColor: "#9fe6b8",
                        borderWidth: 3
                    }
                },
                {
                    value: 6,
                    name: '西安',
                    itemStyle: {
                        color: "#1d9dff",
                        borderColor: "#1d9dff",
                        borderWidth: 3
                    }
                }
                ]
            }]
        };
        o.setOption(option)
    })()

    // 渠道分布
    ; (function () {
        // 创建dom元素
        const dom = document.getElementById('qdfb')
        // 创建echarts对象
        const o = echarts.init(dom)
        var color = ["#FFC2C2", "#FF8C8C", "#FFD4AB", "#FFB46E", "#FFEE99", "#FFE048",];
        var data = [{
            "name": "机场",
            "percent": 0.54,
            "value": 20
        },
        {
            "name": "地铁",
            "percent": 0.80,
            "value": 30
        },
        {
            "name": "汽车站",
            "percent": 0.43,
            "value": 22
        },
        {
            "name": "火车站",
            "percent": 0.76,
            "value": 50
        },
        {
            "name": "商场",
            "percent": 0.49,
            "value": 12
        }
        ];

        var max = data[0].value;
        data.forEach(function (d) {
            max = d.value > max ? d.value : max;
        });

        var renderData = [{
            value: [],
            name: [],
            symbol: 'none',
            lineStyle: {
                normal: {
                    color: '#ecc03e',
                    width: 2
                }
            },
            areaStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 1, 0,
                        [{
                            offset: 0,
                            color: 'rgba(203, 158, 24, 0.8)'
                        }, {
                            offset: 1,
                            color: 'rgba(190, 96, 20, 0.8)'
                        }],
                        false)
                }
            }
        }];


        data.forEach(function (d, i) {
            var value = data.map(d => '');
            value[i] = d.value;
            renderData[0].value[i] = d.value;
            renderData[0].name[i] = d.name;
            renderData[0].areaStyle.normal.color = 'transparent';
            renderData.push({
                value: value,
                symbol: 'circle',
                symbolSize: d.percent * 10,
                lineStyle: {
                    normal: {
                        color: 'transparent'
                    }
                },
                itemStyle: {
                    normal: {
                        color: color[i],
                    }
                }
            })
        })
        var indicator = [];

        data.forEach(function (d) {
            indicator.push({
                name: d.name,
                max: max + 10,
                color: '#005fd4'
            })
        })


        let contentArr = data.map((d) => `${d.name}: ${d.value}, 占比：${d.percent * 100}%`);
        contentArr.unshift('北京');

        const option = {
            title: {
                text: '渠道分布',
                textStyle: {
                    fontWeight: 'normal',
                    fontSize: 16,
                    color: '#F1F1F3'
                },
                top: '5%',
                left: '1.5%'
            },
            tooltip: {
                show: true,
                trigger: "item",
                formatter: contentArr.join('<br />')
            },
            radar: {
                center: ["50%", "50%"],
                radius: "70%",
                startAngle: 90, // 起始角度
                splitNumber: 4,
                shape: "circle",
                splitArea: {
                    areaStyle: {
                        color: 'transparent'
                    }
                },
                axisLabel: {
                    show: false,
                    fontSize: 20,
                    color: "#000",
                    fontStyle: "normal",
                    fontWeight: "normal"
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "rgba(255, 255, 255, 0.5)"
                    }
                },
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: "rgba(255, 255, 255, 0.5)"
                    }
                },
                indicator: indicator
            },
            series: [{
                type: "radar",
                data: renderData
            }]
        }
        o.setOption(option)
    })()

    // 一季度销售进度
    ; (function () {
        // 创建dom元素
        const dom = document.getElementById('xsjd')
        // 创建echarts对象
        const o = echarts.init(dom)
        var percent = 63; //百分数
        var text = '一季度销售进度';
        const option = {
            title: {
                text: '一季度销售进度',
                textStyle: {
                    fontWeight: 'normal',
                    fontSize: 16,
                    color: '#F1F1F3'
                },
                top: '5%',
                left: '5%'
            },
            xAxis: {
                show: false, //是否展示x轴
                min: function (value) { //调整x轴上面数据的位置
                    return value.min - 7;
                },
                max: function (value) {
                    return value.max + 7;
                },
                splitLine: {
                    lineStyle: {
                        show: true,
                        type: 'dashed'
                    }
                },
                "axisLabel": {
                    "interval": 0,
                    rotate: 40,
                    textStyle: {
                        fontSize: 12,
                        color: '#000'
                    },
                },
                data: ['1', '2', '3', '4', '5']
            },
            yAxis: {
                show: false,
                name: '',
                max: 200,
                splitLine: {
                    lineStyle: {
                        type: 'dashed'
                    }
                }
            },
            series: [{
                "name": '',
                "type": 'pie',
                "radius": ['50%', '70%'],
                "avoidLabelOverlap": false,
                "startAngle": 210,
                color: [{
                    type: 'linear',
                    x: 1,
                    y: 0,
                    x2: 0,
                    y2: 0,
                    colorStops: [{
                        offset: 0,
                        color: 'rgba(73, 239, 105,0.5)' // 0% 处的颜色
                    }, {
                        offset: 1,
                        color: 'rgba(73, 239, 105,0)' // 100% 处的颜色
                    }]
                }, 'transparent'],
                "hoverAnimation": false, //是否开启 hover 在扇区上的放大动画效果。
                "legendHoverLink": false, //是否启用图例 hover 时的联动高亮。
                "label": {
                    "normal": {
                        "show": false,
                        "position": 'center'
                    },
                    "emphasis": {
                        "show": true,
                        "textStyle": {
                            "fontSize": '30',
                            "fontWeight": 'bold'
                        }
                    }
                },
                "labelLine": {
                    "normal": {
                        "show": false
                    }
                },
                "data": [{
                    "value": 66,
                    "name": '1',
                    itemStyle: {
                        borderWidth: 3,
                        borderColor: 'rgba(123,123,123,.5)'
                    }
                }, {
                    "value": 34,
                    "name": '2',
                    itemStyle: {
                        borderWidth: 0,
                        borderColor: 'transparent'
                    }
                }]
            },
            {
                "name": ' ',
                "type": 'pie',
                "radius": ['45%', '47%'],
                "avoidLabelOverlap": false, //是否启用防止标签重叠策略
                "startAngle": 0,
                "hoverAnimation": false,
                "legendHoverLink": false,
                "label": {
                    "normal": {
                        "show": false,
                        "position": 'center'
                    },
                    "emphasis": {
                        "show": true,
                        "textStyle": {
                            "fontSize": '30',
                            "fontWeight": 'bold'
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        color: {
                            type: 'linear',
                            x: 1,
                            y: 0,
                            x2: 0,
                            y2: 0,
                            colorStops: [{
                                offset: 0,
                                color: 'rgba(50, 139, 221,0.9)' // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: 'rgba(50, 139, 221,0.2)' // 100% 处的颜色
                            }],
                            global: false // 缺省为 false
                        }
                    }
                },
                "labelLine": {
                    "normal": {
                        "show": false
                    }
                },
                "data": [{
                    "value": 50,
                    "name": '1',
                    itemStyle: {
                        color: [{
                            type: 'linear',
                            x: 1,
                            y: 0,
                            x2: 0,
                            y2: 0,
                            colorStops: [{
                                offset: 0,
                                color: 'rgba(50, 139, 221,0.9)' // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: 'rgba(50, 139, 221,.2)' // 100% 处的颜色
                            }]
                        }, 'transparent'],
                    }
                },
                {
                    "value": 50,
                    "name": '2'
                }
                ]
            },
            {
                "name": '',
                "type": 'pie',
                "radius": ['50%', '70%'],
                "avoidLabelOverlap": false,
                "startAngle": -30,
                "color": ['rgba(34,34,34,.9)', "transparent", "transparent"],
                "hoverAnimation": false,
                "legendHoverLink": false,
                "clockwise": false, //饼图的扇区是否是顺时针排布。
                "itemStyle": {
                    "normal": {
                        "borderColor": "transparent",
                        "borderWidth": "20"
                    },
                    "emphasis": {
                        "borderColor": "transparent",
                        "borderWidth": "20"
                    }
                },
                "z": 10,
                "label": {
                    "normal": {
                        "show": false,
                        "position": 'center'
                    },

                },
                "labelLine": {
                    "normal": {
                        "show": false
                    }
                },
                "data": [{
                    "value": (100 - percent) * 240 / 360,

                    "label": {
                        normal: {
                            formatter: percent + '%',
                            position: 'center',
                            show: true,
                            textStyle: {
                                fontSize: '26',
                                fontWeight: 'normal',
                                color: 'rgba(0,230,179,1)'
                            }
                        }
                    },
                    "name": ''
                }, {
                    "value": 1,
                    "name": ''
                }, {
                    "value": 100 - (100 - percent) * 270 / 360,
                    "name": ''
                }]
            },
            { // 底部
                name: '',
                type: 'pie',
                radius: ['50%', '70%'],

                startAngle: 210,
                endAngle: -30,
                labelLine: {
                    show: false
                },
                z: 15,
                silent: true,
                label: {
                    show: true,
                    rich: {
                        a: {
                            color: '#fff',
                            fontSize: 18,
                            padding: [0, -40, -30, 0]
                        },
                        b: {
                            color: '#fff',
                            fontSize: 18,
                            padding: [0, 0, -40, -50]
                        }
                    },
                    formatter: function (val) { // 底部0和100
                        if (val.dataIndex === 0) {
                            return '{a|0}'
                        }
                        if (val.dataIndex === 2) {
                            return '{b|100}'
                        }
                    }
                },
                data: [{ // 底部两条线
                    value: 3,
                    itemStyle: {
                        color: 'rgba(123,123,123,1)'
                    }
                }, {
                    value: 482,
                    itemStyle: {
                        color: 'transparent'
                    }
                }, {
                    value: 3,
                    itemStyle: {
                        color: 'rgba(123,123,123,1)'
                    }
                }, {
                    value: 245,
                    itemStyle: {
                        color: 'transparent'
                    }
                }]
            },
            {
                "name": ' ',
                "type": 'pie',
                "radius": ['25%', '35%'],
                "avoidLabelOverlap": false, //是否启用防止标签重叠策略
                "startAngle": 150,
                "hoverAnimation": false,
                "legendHoverLink": false,
                "label": {
                    "normal": {
                        "show": false,
                        "position": 'center'
                    },
                    "emphasis": {
                        "show": false,
                        "textStyle": {
                            "fontSize": '30',
                            "fontWeight": 'bold'
                        }
                    }
                },
                "labelLine": {
                    "normal": {
                        "show": false
                    }
                },
                "data": [{
                    "value": 34,
                    "name": '1',
                    itemStyle: {
                        color: [{
                            type: 'linear',
                            x: 1,
                            y: 0,
                            x2: 0,
                            y2: 0,
                            colorStops: [{
                                offset: 0,
                                color: 'rgba(50, 139, 221,0.4)' // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: 'rgba(50, 139, 221,.2)' // 100% 处的颜色
                            }]
                        }, 'transparent'],
                    }
                },
                {
                    "value": 66,
                    "name": '2'
                }
                ]
            },
            {
                name: '指针',
                type: 'gauge',
                pointer: {
                    show: false,
                },
                radius: "54%",
                startAngle: 90, //刻度起始
                endAngle: 90, //刻度结束
                z: 4,
                axisTick: {
                    show: false
                },
                splitLine: {
                    length: 16, //刻度节点线长度
                    lineStyle: {
                        width: 3,
                        color: 'rgba(255,255,255, 0.9)',
                        shadowColor: 'rgba(255,255,255,.2)',
                        shadowBlur: 5
                    } //刻度节点线
                },
                axisLabel: {
                    color: 'rgba(255,255,255,0)',
                    fontSize: 12,
                }, //刻度节点文字颜色
                axisLine: {
                    lineStyle: {
                        opacity: 0,
                    }
                },
                detail: {
                    show: false
                }
            },
            {
                name: '阴影',
                "type": 'pie',
                "radius": ['10%', '50%'],
                "avoidLabelOverlap": false,
                "startAngle": -22,
                // "color": ['transparent', "transparent", "transparent"],
                "hoverAnimation": false,
                "legendHoverLink": false,
                "clockwise": false, //饼图的扇区是否是顺时针排布。
                "itemStyle": {
                    "normal": {
                        "borderColor": "transparent",
                        "borderWidth": "20"
                    },
                    "emphasis": {
                        "borderColor": "transparent",
                        "borderWidth": "20"
                    }
                },
                "z": 10,
                "label": {
                    "normal": {
                        "show": false,
                        "position": 'center'
                    },

                },
                "labelLine": {
                    "normal": {
                        "show": false
                    }
                },
                "data": [{
                    "value": (100 - percent) * 240 / 360,
                    "label": {
                        normal: {
                            formatter: percent + '%',
                            position: 'center',
                            show: true,
                            textStyle: {
                                fontSize: '90',
                                fontWeight: 'normal',
                                color: 'transparent'
                            }
                        }
                    },
                    itemStyle: {
                        normal: {
                            color: 'rgba(255,255,255,0)'
                        }
                    },
                    "name": 'transparent'
                }, {
                    "value": 10,
                    "name": '',

                },
                {
                    "value": 100 - (100 - percent) * 270 / 360,
                    "name": '',
                }
                ]

            }

            ]
        };
        o.setOption(option)
    })()
    // 销售额统计
    ; (function () {
        const dom = document.getElementById('xsedtj')
        const o = echarts.init(dom)
        var text = '销售额统计';
        var iconImg = 'path://M810.666 128H213.334C166.396 128 128 166.396 128 213.334v597.332C128 857.604 166.396 896 213.334 896h597.332C857.604 896 896 857.604 896 810.666V213.334C896 166.396 857.604 128 810.666 128z m-384 597.334L213.334 512l59.728-59.728 153.604 153.604 324.272-324.272 59.728 59.73-384 384z'
        var data = {
            legendList: [{
                name: "显示上月",
                icon: iconImg
            },
            {
                name: "预期销售额",
                icon: iconImg
            },
            {
                name: "实际销售额",
                icon: iconImg
            }
            ],
            monthList: ["19/012", "20/01", "20/02", "20/03", "20/04", "20/05"],
            placingList: [{
                name: "显示上月",
                type: 'bar',
                data: [11, 20, 10, 4, 12, 10]
            },
            {
                name: "显示上月",
                type: 'bar',
                data: [10, 20, 11, 12, 6, 10]
            },
            {
                name: "显示上月",
                type: 'line',
                data: [70, 90, 100, 170, 80, 60]
            },
            {
                name: "显示上月",
                type: 'line',
                data: [50, 70, 90, 160, 90, 120]
            },
            {
                name: "显示上月",
                type: 'line',
                data: [30, 60, 80, 150, 90, 160]
            },
            {
                name: "预期销售额",
                type: 'bar',
                data: [10, 11, 32, 21, 12, 12]
            },
            {
                name: "实际销售额",
                type: 'bar',
                data: [20, 22, 22, 23, 31, 55]
            }
            ],
        }
        const option = {
            title: {
                text: '销售额统计',
                textStyle: {
                    fontWeight: 'normal',
                    fontSize: 16,
                    color: '#F1F1F3'
                },
                top: '3%',
                left: '3%'
            },
            backgroundColor: '#0e1c47',
            tooltip: {
                trigger: 'axis',
                textStyle: {
                    fontSize: 9,
                }
            },
            grid: {
                top: '18%',
                left: '7%',
                right: '7%',
                bottom: '25%',
            },
            legend: {
                data: data.legendList,
                top: "10%",
                textStyle: {
                    color: "rgba(255,255,255,.61)"
                }
            },
            xAxis: [{
                type: 'category',
                boundaryGap: true,
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: 'rgba(164,161,169,.3)'
                    },
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "rgba(164,161,169,.3)"
                    }
                },
                axisLabel: {
                    textStyle: {
                        color: '#9AA1A9',
                    },
                },
                axisTick: {
                    show: false,
                },
                data: data.monthList
            }],
            yAxis: [{
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: 'rgba(164,161,169,.3)'
                    },
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "rgba(164,161,169,.3)"
                    }
                },
                axisLabel: {
                    show: true,
                    textStyle: {
                        color: '#9AA1A9',
                    }
                },
                axisTick: {
                    show: false,
                },
            }, {
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: 'rgba(164,161,169,.3)'
                    },
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: "rgba(164,161,169,.3)"
                    }
                },
                axisLabel: {
                    show: true,
                    textStyle: {
                        color: '#9AA1A9',
                    },
                    formatter: "{value}%"
                },
                axisTick: {
                    show: false,
                },
            }],
            series: [{
                name: '预期销售额',
                type: 'bar',
                barWidth: 15,
                stack: '实际销售额',
                symbol: 'fixed',
                yAxisIndex: 1,
                itemStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(101,102,187,1)' // 0% 处的颜色
                        }, {
                            offset: 1,
                            color: 'rgba(107,101,187,1)' // 100% 处的颜色
                        }], false),
                        lineStyle: {
                            type: 'solid'
                        }
                    }
                },
                data: data.placingList[0].data
            }, {
                type: 'bar',
                name: '显示上月',
                barWidth: 15,
                stack: '显示上月',
                yAxisIndex: 1,
                itemStyle: {
                    normal: {
                        color: 'rgba(101,102,187,.4)',
                        lineStyle: {
                            type: 'dashed'
                        }
                    }
                },
                data: data.placingList[5].data
            }, {
                type: 'bar',
                name: '显示上月',
                barWidth: 15,
                stack: '显示上月',
                yAxisIndex: 1,
                itemStyle: {
                    normal: {
                        color: 'rgba(102,214,222,.4)',
                        lineStyle: {
                            type: 'dashed'
                        }
                    }
                },
                data: data.placingList[6].data
            }]
        };
        o.setOption(option)
    })()
    // 全国热销
    ; (function () {
        const dom = document.getElementById('qgrx')
        const o = echarts.init(dom)
        var text = '全国热销';
        var xData = ['北京', '山西', '陕西', '山东', '江苏'];
        var y1Data = [10758, 3975, 2980, 1831, 2122];
        var y2Data = [28, 4.4, 5.9, 0.9, 0.7];
        const option = {
            grid: {
                left: '15%',
                right: '10%',
                top: '25%',
                bottom: '19%',
            },
            title: {
                text: '全国热销',
                textStyle: {
                    fontWeight: 'normal',
                    fontSize: 16,
                    color: '#F1F1F3'
                },
                top: '3%',
                left: '3%'
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: { // 坐标轴指示器，坐标轴触发有效
                    type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
                }
            },
            legend: {
                data: ['各省热销', '销量密度'],
                right: '3%',
                top: '10%',
                itemWidth: 11,
                itemHeight: 11,
                textStyle: {
                    color: '#ffffff',
                    fontSize: 13
                }
            },
            toolbox: {
                show: false,
            },
            xAxis: [{
                type: 'category',
                boundaryGap: true,
                show: true,
                axisTick: {
                    show: false
                },
                axisLabel: {
                    fontSize: 15,
                    color: '#d0d0d0',
                    margin: 8,
                    interval: 0,
                    formatter: function (val) {
                        return val.split("").join("\n");
                    }
                },
                axisLine: {
                    lineStyle: {
                        type: 'solid',
                        color: '#4e608b', //左边线的颜色
                        width: '1' //坐标线的宽度
                    }
                },
                data: xData
            }],
            yAxis: [{
                type: 'value',
                scale: true,
                name: '',
                axisLine: {
                    show: false
                },
                splitNumber: 4,
                axisTick: {
                    show: false
                },
                splitLine: {
                    lineStyle: {
                        // 使用深浅的间隔色
                        color: '#4e608b'
                    }
                },
                axisLabel: {
                    fontSize: 13,
                    color: '#d0d0d0',
                    margin: 12,
                },
                max: 12000,
                min: 0,
                boundaryGap: [0.2, 0.2]
            },
            {
                type: 'value',
                scale: true,
                axisLine: {
                    show: false
                },
                splitNumber: 3,
                axisTick: {
                    show: false
                },
                axisLabel: {
                    fontSize: 13,
                    color: '#d0d0d0',
                    margin: 12,
                },
                splitLine: {
                    lineStyle: {
                        // 使用深浅的间隔色
                        color: '#4e608b'
                    }
                },
                name: '',
                max: 30,
                min: 0,
                boundaryGap: [0.2, 0.2]
            },

            ],
            series: [{
                name: '各省热销',
                type: 'bar',
                label: {
                    normal: {
                        show: true,
                        position: 'top',
                        textStyle: {
                            color: '#1dacfe'
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
                            offset: 0,
                            color: "#4889fb" // 0% 处的颜色
                        }, {
                            offset: 1,
                            color: "#15b3ff" // 100% 处的颜色
                        }], false)
                    }
                },
                barWidth: '40%',
                yAxisIndex: 0,
                data: y1Data
            },
            {
                name: '销量密度',
                yAxisIndex: 1,
                color: '#ffd300',
                label: {
                    normal: {
                        show: true,
                        position: 'top',
                        textStyle: {
                            color: '#ffd300'
                        }
                    }
                },
                lineStyle: {
                    color: '#ffd300'
                },
                type: 'line',
                data: y2Data
            }
            ]
        };
        o.setOption(option)
    })()
    // 故障设备
    ; (function () {
        const dom = document.getElementById('gzsb')
        const o = echarts.init(dom)
        var text = '各省用户数量';
        var spirit = 'image://';

        var maxData = 200;

        option = {
            title: {
                text: '各省用户数量',
                left: 'center',
                y: 10,
                textStyle: {
                    color: '#fff'
                }
            },
            grid: {
                left: 60,
                top: 30,
                bottom: 10
            },
            tooltip: {
                trigger: 'item',
                textStyle: {
                    fontSize: 14
                },
                formatter: '{b0}:{c0}'
            },
            xAxis: {
                splitLine: {
                    show: false
                },
                axisLine: {
                    show: false
                },
                axisLabel: {
                    show: false
                },
                axisTick: {
                    show: false
                }
            },
            yAxis: [{
                type: 'category',
                inverse: false,
                data: [
                    '山西',
                    '四川',
                    '西藏',
                    '北京',
                    '上海',
                    '内蒙古',
                    '云南',
                    '黑龙江',
                    '广东',
                    '江苏'
                ],
                axisLine: {
                    show: false
                },
                axisTick: {
                    show: false
                },
                axisLabel: {
                    margin: -4,
                    textStyle: {
                        color: '#fff',
                        fontSize: 16.25
                    }
                }
            },

            ],
            series: [{
                type: 'pictorialBar',
                symbol: 'image://',
                symbolRepeat: true,
                symbolMargin: '5%',
                symbolClip: 'true',
                symbolSize: 20,
                symbolPosition: 'start',

                label: {
                    normal: {
                        show: true,
                        position: 'insideRight',
                        offset: [40, 0],
                        color: '#fff',
                        formatter: function (params) {
                            return params.value;
                        }
                    }
                },
                symbolBoundingData: 10000,
                data: [11233, 23212, 21267, 18211, 18346, 19324, 13266, 12220, 10249, 9262]

            }]
        };
        o.setOption(option)
    })()